<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FalconKMS Installer Step 4</title>

<style>
p {
	font-family:Verdana, Arial, Helvetica, sans-serif;
	font-size:14px;
}
</style>
</head>
<body>

<?php

include_once "../config.php";

if ((isset($_POST['password1'])) && (isset($_POST['username'])))
{
	// Process New Administrator
	if ($_POST['password1'] == $_POST['password2'])
	{
		$password = sha1($_POST['password1']);
		$username = $_POST['username'];
		
		// Create user
		$sql = "INSERT INTO `kb_player` (`playerID`, `playerName`, `killPoints`, `lossPoints`, `netPoints`, 
		`corpID`, `password`, `canPost`, `canAdmin`, `filter`) VALUES (NULL, '$username', 0, 0, 0, 0, '$password', 1, 1, 0);";
		
		$queryResult = mysql_query($sql);
		
		echo (mysql_error());
		
		echo("<p>Install Complete, you should delete the installer folder from your server!</p>");		
	}
	else
	{
	?>
		<form method="post" action="newinstall4.php">
			
			<p>
			Administrator UserName: <input type="text" name="username" />
			<br />Password: <input type="password" name="password1" /> passwords do not match!!
			<br />Confirm Password: <input type="password" name="password2" />
			<br /><input type="submit" value="Next"/>
			
			</p>

		</form>
	<?php	
	}	
}

else
{

?>

<form method="post" action="newinstall4.php">

<p>
Administrator UserName: <input type="text" name="username" />
<br />Password: <input type="password" name="password1" />
<br />Confirm Password: <input type="password" name="password2" />
<br /><input type="submit" value="Next"/>

</p>

</form>

<?php
}
?>


</body>
</html>
